<%@page contentType="text/html; charset=utf-8"%>
<%@ include file="./inc/TagLibs.jsp"%>
<c:set var="pageTitle" value="用户登录" />
<%@ include file="./inc/Title.jsp"%>
<head>
<link rel="stylesheet" type="text/css" href="/css/base.css" />
<script language="javascript">
	var errorIndex=0
	function showErrorMsg(msg,index){
		if(errorIndex==0 || (errorIndex!=0 && errorIndex>index)){
			errorIndex=index;
			document.getElementById("errorMsgTd").innerHTML=msg;
		}
	}
	function goNextInput(objName){
		var obj=null;
		if(objName!=null && objName!=''){
			obj=document.getElementById(objName);
		}
		if(window.event.keyCode==13){
			if(obj!=null){
				obj.focus();
			}else{
				document.getElementById("loginButton").disabled="true";
				loginFrm.submit();
			}
		}
	}
	function doInit(){
		document.getElementById("mainTbl").style.height=document.documentElement.clientHeight+"px";
		document.getElementById("userName").focus();
	}
</script>
</head>
<body oncontextmenu="return false" onload="doInit();" class="sheet modal-dialog" style="TEXT-ALIGN: center;">
<table border="0" cellspacing="1" cellpadding="1" width="100%" id="mainTbl">
	<tr>
		<td align="center" valign="middle">
			<div class="sheet-main" style="width:280px;margin:auto;text-align:left;">
			<form name="loginFrm" method="post">
			    <div class="modal-main search-business">
		    		<div style="width:100%;">
						<h3 id="errorMsgTd">${alertMsg}</h3>
						<c:remove var="alertMsg" scope="session" />
						<table border="0" cellspacing="1" cellpadding="1" align="center" class="table-a">
						        <spring:bind path="command.userName">
						        <tr>
						          <th>用户名：</th>
						          <td><input class="TextBox" type="text" style="width:160px" onKeyUp="goNextInput('password');" id='${status.expression}' name='${status.expression}' value='<c:out value="${status.value}" />' style="width:150"></td>
						        </tr>
						        <c:if test="${status.errorMessage!=null && status.errorMessage!=''}">
						          <script language="javascript">
						          	showErrorMsg('<c:out value="${status.errorMessage}" />',1);
						          	loginFrm.userName.focus();
						          </script>
						      	</c:if>
						        </spring:bind>
						        <spring:bind path="command.password">
						        <tr>
						          <th>密&nbsp;&nbsp;码：</th>
						          <td><input class="TextBox" type="password" style="width:160px" onKeyUp="goNextInput('validateCode');" id='${status.expression}' name='${status.expression}' value='<c:out value="${status.value}" />' style="width:150"></td>
						        </tr>
						        <c:if test="${status.errorMessage!=null && status.errorMessage!=''}">
						          <script language="javascript">
						          	showErrorMsg('<c:out value="${status.errorMessage}" />',2);
						          	loginFrm.password.focus();
						          </script>
						      	</c:if>
						        </spring:bind>
						        <spring:bind path="command.validateCode">
						        <tr>
						          <th>验证码：</th>
						          <td>
						          	<input class="TextBox" style="width:80px" type="text" onKeyUp="goNextInput('');" id='${status.expression}' name='${status.expression}' value=''>
						          	<img src="RandomImageCode.ihtm" align="absmiddle">
						          </td>
						        </tr>
						        <c:if test="${status.errorMessage!=null && status.errorMessage!=''}">
						          <script language="javascript">
						          	showErrorMsg('<c:out value="${status.errorMessage}" />',3);
						          	loginFrm.validateCode.focus();
						          </script>
						      	</c:if>
						      	</spring:bind>
						</table>
					</div>
			  	</div>
				<div class="modal-buttom">
					<input type="button" value=" 登 录 " class="buttom-a" id="loginButton" onClick="this.disabled='true';loginFrm.submit();">	
				</div>
			</form>
			</div>
		</td>
	</tr>
</table>
</body>
</html>